package com.ss.ttm.player;

import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.view.Surface;
import android.view.SurfaceHolder;

import java.io.IOException;
import java.util.Map;

import inline.ScreenshotListener;

public final class AndroidMediaPlayerClient extends MediaPlayerClient {
    final class OnBufferingUpdateListenerProxy implements MediaPlayer.OnBufferingUpdateListener {
        private IMediaPlayerClient.OnBufferingUpdateListener onBufferingUpdateListener;

        public OnBufferingUpdateListenerProxy(IMediaPlayerClient.OnBufferingUpdateListener onBufferingUpdateListener) {
            this.onBufferingUpdateListener = onBufferingUpdateListener;
        }

        public final void onBufferingUpdate(MediaPlayer mediaPlayer, int percent) {
            this.onBufferingUpdateListener.onBufferingUpdate(percent);
        }
    }

    final class OnCompletionListenerProxy implements MediaPlayer.OnCompletionListener {
        private IMediaPlayerClient.OnCompletionListener onCompletionListener;

        public OnCompletionListenerProxy(IMediaPlayerClient.OnCompletionListener onCompletionListener) {
            this.onCompletionListener = onCompletionListener;
        }

        public final void onCompletion(MediaPlayer mediaPlayer) {
            this.onCompletionListener.onCompletion();
        }
    }

    final class OnErrorListenerProxy implements MediaPlayer.OnErrorListener {
        private IMediaPlayerClient.OnErrorListener onErrorListener;
        private IMediaPlayerClient mediaPlayerClient;

        public OnErrorListenerProxy(IMediaPlayerClient.OnErrorListener onErrorListener, IMediaPlayerClient mediaPlayerClient) {
            this.mediaPlayerClient = mediaPlayerClient;
            this.onErrorListener = onErrorListener;
        }

        public final boolean onError(MediaPlayer mp, int what, int extra) {
            return this.onErrorListener.onError(this.mediaPlayerClient, what, extra);
        }
    }

    final class OnInfoListenerProxy implements MediaPlayer.OnInfoListener {
        private IMediaPlayerClient.OnInfoListener onInfoListener;

        public OnInfoListenerProxy(IMediaPlayerClient.OnInfoListener onInfoListener) {
            this.onInfoListener = onInfoListener;
        }

        public final boolean onInfo(MediaPlayer mediaPlayer, int what, int extra) {
            return this.onInfoListener.onInfo(what);
        }
    }

    final class OnPreparedListenerProxy implements MediaPlayer.OnPreparedListener {
        private IMediaPlayerClient.OnPreparedListener onPreparedListener;

        public OnPreparedListenerProxy(IMediaPlayerClient.OnPreparedListener onPreparedListener) {
            this.onPreparedListener = onPreparedListener;
        }

        @Override
        public final void onPrepared(MediaPlayer mediaPlayer) {
            this.onPreparedListener.onPrepared();
        }
    }

    final class OnSeekCompleteListenerProxy implements MediaPlayer.OnSeekCompleteListener {
        private IMediaPlayerClient.OnSeekCompleteListener onSeekCompleteListener;

        public OnSeekCompleteListenerProxy(IMediaPlayerClient.OnSeekCompleteListener onSeekCompleteListener) {
            this.onSeekCompleteListener = onSeekCompleteListener;
        }

        @Override
        public final void onSeekComplete(MediaPlayer mediaPlayer) {
            this.onSeekCompleteListener.onSeekComplete();
        }
    }

    final class OnVideoSizeChangedListenerProxy implements MediaPlayer.OnVideoSizeChangedListener {
        private IMediaPlayerClient.OnVideoSizeChangedListener onVideoSizeChangedListener;

        public OnVideoSizeChangedListenerProxy(IMediaPlayerClient.OnVideoSizeChangedListener onVideoSizeChangedListener) {
            this.onVideoSizeChangedListener = onVideoSizeChangedListener;
        }

        public final void onVideoSizeChanged(MediaPlayer mediaPlayer, int width, int height) {
            this.onVideoSizeChangedListener.onVideoSizeChanged(width, height);
        }
    }

    private MediaPlayer mMediaPlayer;
    private IMediaPlayerClient mMediaPlayerClient;

    public AndroidMediaPlayerClient() {

    }

    public static synchronized final AndroidMediaPlayerClient createAndroidMediaPlayerClient(IMediaPlayerClient mediaPlayerClient) {
        AndroidMediaPlayerClient androidMediaPlayerClient = new AndroidMediaPlayerClient();
        androidMediaPlayerClient.mMediaPlayer = new MediaPlayer();
        androidMediaPlayerClient.mMediaPlayerClient = mediaPlayerClient;
        return androidMediaPlayerClient;
    }

    public final int getCurrentPosition() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.getCurrentPosition() : 0;
    }

    public final int getDuration() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.getDuration() : 0;
    }

    public final int getType() {
        return 0;
    }

    public final int getVideoHeight() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.getVideoHeight() : 0;
    }

    public final int getVideoWidth() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.getVideoWidth() : 0;
    }

    public final boolean isLooping() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.isLooping() : false;
    }

    public final boolean isPlaying() {
        return this.mMediaPlayer != null ? this.mMediaPlayer.isPlaying() : false;
    }

    public final void pause() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.pause();
        }
    }

    public final void prepare() {
        if (this.mMediaPlayer != null) {
            try {
                this.mMediaPlayer.prepare();
            } catch (IOException ioException) {
                ioException.printStackTrace();
            } catch (IllegalStateException illegalStateException) {
                illegalStateException.printStackTrace();
            }
        }
    }

    public final void prepareAsync() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.prepareAsync();
        }
    }

    public final void prevClose() {
    }

    public final void release() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.release();
        }
    }

    public final void reset() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.reset();
        }
    }

    public final void seekTo(int position) {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.seekTo(position);
        }
    }

    public final void setDataSource(Context context, Uri uri) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
        this.mMediaPlayer.setDataSource(context, uri);
    }

    public final void setDataSource(Context arg2, Uri arg3, Map arg4) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
        this.mMediaPlayer.setDataSource(arg2, arg3, arg4);
    }

    public final void setDataSource(String arg2) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
        this.mMediaPlayer.setDataSource(arg2);
    }

    public final void setDisplay(SurfaceHolder arg2) {
        if (this.mMediaPlayer != null && arg2 != null && (arg2.getSurface().isValid())) {
            try {
                this.mMediaPlayer.setDisplay(arg2);
            } catch (Exception v0) {
            }
        }
    }

    public final void setLooping(boolean arg2) {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setLooping(arg2);
        }
    }

    public final void setOnBufferingUpdateListener(IMediaPlayerClient.OnBufferingUpdateListener arg3) {
        this.mMediaPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListenerProxy(arg3));
    }

    public final void setOnCompletionListener(IMediaPlayerClient.OnCompletionListener arg3) {
        this.mMediaPlayer.setOnCompletionListener(new OnCompletionListenerProxy(arg3));
    }

    public final void setOnErrorListener(IMediaPlayerClient.OnErrorListener onErrorListener) {
        this.mMediaPlayer.setOnErrorListener(new OnErrorListenerProxy(onErrorListener, this.mMediaPlayerClient));
    }

    public final void setOnInfoListener(IMediaPlayerClient.OnInfoListener arg3) {
        this.mMediaPlayer.setOnInfoListener(new OnInfoListenerProxy(arg3));
    }

    public final void setOnPreparedListener(IMediaPlayerClient.OnPreparedListener arg3) {
        this.mMediaPlayer.setOnPreparedListener(new OnPreparedListenerProxy(arg3));
    }

    public final void setOnSeekCompleteListener(IMediaPlayerClient.OnSeekCompleteListener arg3) {
        this.mMediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListenerProxy(arg3));
    }

    public final void setOnVideoSizeChangedListener(IMediaPlayerClient.OnVideoSizeChangedListener arg3) {
        this.mMediaPlayer.setOnVideoSizeChangedListener(new OnVideoSizeChangedListenerProxy(arg3));
    }

    public final void setScreenOnWhilePlaying(boolean arg2) {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setScreenOnWhilePlaying(arg2);
        }
    }

    public final void setSurface(Surface arg2) {
        this.mMediaPlayer.setSurface(arg2);
    }

    public final void setVolume(float arg2, float arg3) {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setVolume(arg2, arg3);
        }
    }

    public final void setWakeMode(Context arg2, int arg3) {
        this.mMediaPlayer.setWakeMode(arg2, arg3);
    }

    public final void start() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.start();
        }
    }

    public final void stop() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.stop();
        }
    }

    public final void takeScreenshot$61a88cc1(ScreenshotListener arg1) {
    }
}

